package com.hand.springbootdemo.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.ServletRequestBindingException;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

/**
 * @author 13278
 */
@RestController
public class HelloController {
    private final Logger logger = LoggerFactory.getLogger(HelloController.class);

    @GetMapping("/hello")
    public String hello() {
        return "hello";
    }

    @GetMapping("/log-print-test")
    public Map<String, Object> logPrintTest() {
        logger.trace("trace");
        logger.debug("info");
        logger.info("info");
        logger.warn("warn");
        logger.error("error");
        return new HashMap<String, Object>(10) {{
            put("code", 200);
            put("message", "打印成功，请到控制台查看");
        }};
    }
}
